package org.example.util;

import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class CommonRequestHandle {
    public static <T> T getRequest(CommonRequest commonRequest, Class<T> clazz) {
        Gson instance = GsonUtil.getInstance();
        T o = null;
        try {
            String s = instance.toJson(commonRequest.getBizContent());
            o = GsonUtil.getInstance().fromJson(s, clazz);
        } catch (JsonSyntaxException e) {
            log.error(e.getMessage());
        }
        return o;
    }
}